<template>
	<view>
		<u-subsection :list="list" :current="current" @change="sectionChange"></u-subsection>
		<!-- <uni-list v-for="(item ,index) in orderList" :index="index" :key="index">
		 	<uni-list-item :title="item.id" :note="item.remark" thumb-size="lg"  @click="toDetail(item)" :rightText="item.createTime" ></uni-list-item>
		</uni-list> -->
		<!-- <uni-section v-for="(item ,index) in orderList" :index="index" :key="index"> -->
		<view v-for="(item ,index) in orderList" :index="index" :key="index">
			<uni-card :title="item.id" :sub-title="item.money.toString()" :extra="item.createTime" :thumbnail="avatar" @click="onClick">
				<view  class="uni-body">
					<text>
						订单备注：{{item.remark}}_费用：{{item.money}}
					</text>
					<!-- <u-tag text="标签" plain size="mini" type="warning"></u-tag> -->
				</view>
			</uni-card>
		</view>
			
		<!-- </uni-section> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				orderList: [],
				list: ['未付款', '待收货','待评价', '已完成'],
				current: 0
			}
		},
		onShow() {
			this.getOrderList(this.current);
		},
		onLoad(options) {
			this.sectionChange(options.index);
		},
		methods: {
			getOrderList(){
				console.log("数字"+this.current)
				if(this.current == null){
					this.current == 0
				}
				let uid = uni.getStorageSync("uid")
				this.apis.listOrderByUserId({userId:uid,status:this.current}).then(res => {
					this.orderList = res
					console.log("数据"+this.orderList)
				})
			},
			sectionChange(index) {
				this.current = index;
				this.getOrderList()
				// this.getOrderList(this.current);
			},
			toDetail(item) {
				console.log("点击转到详情页")
				uni.setStorageSync('orderDetail', item)
				uni.navigateTo({
					url: "/pagesOne/orderDetail/orderDetail?id=" + item.id
				})
			},
		}
	}
</script>

<style lang="scss">
	.bottom-btn{
		position: fixed;
		bottom: 0%;
		width: 100%;
		
	}
</style>
